package wjh.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import wjh.pojo.Plan;
import wjh.pojo.PlanVo;

import java.util.List;

@Repository
public interface PlanMapper {
//    @Select("        SELECT plan.id,plan.number,plan.week,doctor.name AS doctor_name,dp.department_name\n" +
//            "        FROM plan INNER JOIN doctor ON plan.doctor_id=doctor.id\n" +
//            "        INNER JOIN department AS dp ON doctor.department_id=dp.id\n" +
//            "        ORDER BY plan.id")
    List<PlanVo> findAllPai();

    List<PlanVo> findAllPaiLike(@Param("likeName") String likeName);

    //根据医生id和星期几查询一下有没有该记录
    @Select("SELECT * FROM plan WHERE doctor_id=#{id} AND WEEK=#{week}")
    Plan findByIdAndWeek(@Param("id") Integer id,@Param("week") String week);

    @Delete("delete from plan where id=#{value}")
    void delPaisById(int id);

    @Select("select * from plan where id=#{value}")
    Plan findPaiById(Integer id);
}
